﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using RooHui.Infrastructure.Entities.EFContext;
using RooHui.Infrastructure.Entities.Repository;
using RooHui.Infrastructure.Entities.Enum;

namespace RooHui.Infrastructure.Entities.Entity
{
    public class ProjectPolicy : IAccessible<P_ProjectPolicy, ProjectPolicy>, ILogicEntity<P_ProjectPolicy, ProjectPolicy>
    {
        public int ID { get; set; }
        public int PolicyId { get; set; }
        public int ProjectId { get; set; }

        protected override void Covariant(P_ProjectPolicy model)
        {
            if (model != null)
            {
                this.ID = model.ID;
                this.PolicyId = model.PolicyId;
                this.ProjectId = model.ProjectId;
            }
        }

        protected override P_ProjectPolicy Inverter(ProjectPolicy model)
        {
            if (model != null)
            {
                return new P_ProjectPolicy()
                {
                    ID = model.ID,
                    PolicyId = model.PolicyId,
                    ProjectId = model.ProjectId
                };
            }
            return null;
        }

        public ProjectPolicy Set(P_ProjectPolicy dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
